<!--{if $do=='addorg'}-->
<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-weight:normal;font-size:20px;"></button>
	<h3>{lang new_team}</h3>
</div>

	<div class="popbox-body" style="width:300px;padding:15px">
		<p id="return_addorg" class="text-danger "></p>
		<!--{if $setting[maxorganization] || $_G['adminid']}-->
		<!--{if $newperm[new]}-->
		<form class="form " id="addorg_form" role="form" method="post" action="{MOD_URL}&op=menu&do=addorg" onsubmit="return addorg_submit(this);">
		<input type="hidden" name="handlekey" value="addorg" />
		<input type="hidden" name="addorgsubmit" value="true" />
		<input type="hidden" name="formhash" value="{FORMHASH}" />

		<div class="form-group">
			<label>{lang menu_filemanagedisp_0}</label>
			<input type="text" name="name" class="form-control" placeholder="{lang group_name}">
		</div>
		<div class="form-group">
			<label>{lang synopsis}</label>
			<textarea class="form-control" name="desc" rows="3"></textarea>
		</div>
		<div class="form-group">
			<button id="addorgsubmit_btn" type="submit" class="btn btn-success" style="width:120px;" data-loading-text="{lang save_in_the}">{lang create}</button>
		</div>
		
		</form>
		<!--{else}-->
		<div class="form-group">
			<label class="text-center text-danger">{lang no_privilege}</label>
			<div class="help-block">
				$errmsg
			</div>
		</div>
	<!--{/if}-->
		<div class="help-block ">
			<b>{lang group}</b>{lang for_better_collaboration_and_management}
		</div>
	</div>
<!--{else}-->
管理员已关闭新建小组功能
<!--{/if}-->
<script type="text/javascript" reload="1">
	jQuery(window).scrollTop(jQuery('.popbox').offset()['top']);

	function addorg_submit(form) {
		if(form.name.value == '') {
			form.name.focus();
			return false;
		}
		jQuery('#addorgsubmit_btn').button('loading');
		ajaxpost('addorg_form', 'return_addorg', 'return_addorg');
	}

	function succeedhandle_addorg(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		var html = '<div class="window-module window-module-org">' +
			'<div class="window-module-title window-module-title-no-divider">' +
			'		<span class="dzz dzz-group"></span>' +
			'		<span class="article_title">' + values['name'] + '<a class="u-inline-block quiet dark-hover js-view-org-profile" href="{MOD_URL}&op=org&orgid=' + values['orgid'] + '" style="margin-left:20px;"><i class="icon-sm icon-information fa fa-info-circle"></i> '+__lang.team_details+'</a></span>' +
			'		<span class="js-ad"></span>' +
			'	</div>' +
			'	<ul id="board_list_' + values['orgid'] + '" class="board-list u-gutter clearfix list-unstyled js-board-list">' +
			'		<li  class="js-add-board"><a class="board-list-item--add-board js-popbox" data-href="{MOD_URL}&op=menu&do=newcorpus&orgid=' + values['orgid'] + '" title="'+__lang.create_corpus+'" data-placement="cover"  href="javascript:;">'+__lang.create_corpus+'</a></li>' +
			'	</ul>' +
			' </div>';
			
		
	var html1 = '<div class="window-list  window-list-org">';
		html1 += '<div class="list-flex">';
			html1 += '<div class="list-flex1 list-flex-top">';
				html1 += '<span >' + values['name'] + '</span>&nbsp;&nbsp;<a class="js-popbox" data-href="{MOD_URL}&op=menu&do=newcorpus&orgid=' + values['orgid'] + '" title="'+__lang.create_corpus+'" data-placement="right"  data-auto-adapt="true" href="javascript:;">'+__lang.create_corpus+'</a>';
			html1 += '</div>';
			html1 += '<div class="list-flex2"></div>';
			html1 += '<div class="list-flex3" style="padding-top: 10px;"><a class="u-inline-block quiet" target="_blank" href="{MOD_URL}&op=org&orgid=' + values['orgid'] + '"><i class="icon-sm icon-information fa fa-info-circle"></i>'+__lang.team_details+'</a></div>';			
		html1 += '</div>';
		html1 += '<div id="board_table_' + values['orgid'] + '" class="list-flex-conten">';		
		html1 += '</div>';
	html1 += '</div>';		
		var el = jQuery(html).insertBefore('.window-module-add');
		jQuery(html1).insertBefore('.window-list-add').find('.js-popbox').popbox();
		el.find('.js-popbox').each(function() {
			jQuery(this).popbox();
		});
	};
</script>
<!--{elseif $do=='import'}-->
<div class="popbox-header text-center">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" style="font-weight:normal;font-size:20px;"></button>
	<h3>{lang import_from_Ebooks}</h3>
</div>
<div id="popbox_import" class="popbox-body" style="width:300px;">
	<div class="form-group">
		<label>{lang import_description}</label>
		<ul class="help-block">
			<li>{lang click_the_upload_button_below_to_upload_the_ebook}</li>
			<li>{lang epub_txt}</li>
			<li>{lang non_standard_format_of_ebooks_may_not_be_successful}</li>
			<li>{lang txt_novel_import}</li>
		</ul>
	</div>

	<div class="form-group" style="margin-bottom:0;">
		<input name="aid" value="0" type="hidden" onchange="newcorpus_import(this)" />
		<div class="uploadmessage" style="line-height:30px;margin-bottom:10px;">

		</div>
		<div class="addPhotoBar" style="position:relative;padding:10px;border:1px dashed #e1e1e1;overflow:hidden">
			<div class="uploadwrap"><input id="fileupload_import" type="file" name="files[]" accept="application/epub+zip,.epub,.txt" /></div>
			<div class="addbtn">
				<i class="glyphicon glyphicon-import"></i>{lang select_the_ebook_you_want_to_import}<br />&nbsp;&nbsp;{lang non_ie_browser_can_be_dragged_here}
			</div>
		</div>
	</div>
</div>

<script type="text/javascript" reload="1">
	function newcorpus_import(obj) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		showmessage('<i class="fa fa-spinner fa-spin"></i>'+__lang.changing_wait+'<small>'+__lang.no_close_the_browser+'</small>', 'warning', 0, 1);
		convert_waiting('{MOD_URL}&op=import&orgid=$orgid&aid=' + obj.value + '&filename=' + encodeURI(jQuery(obj).data('filename')), function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 0, 1);
			} else if(json.cid > 0) {
				showmessage(__lang.import_success, 'success', 1000, 1);
				var html = '<li class="" data-cid="' + json['cid'] + '"><span class="item-guide perm_0"> </span>' +
					'	<a class="js-open-board highlight-icon color-white" href="{MOD_URL}&op=list&cid=' + json['cid'] + '" target="_blank">';
				if(json['path']) {
					html += '    <img class="cover" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=512&height=512&path=' + json['path'] + '" onload="setImage(this,150,200);">';
				}
				html += '    <span class="fade"></span>' +
					'   <span class="unread-indicator js-unread" title="'+__lang.new_change+'"></span>' +
					'    <span class="icon-sm icon-star js-star-board icon-star-sm js-star" title="'+__lang.star_sign_or_cancel+'" data-cid="' + json['cid'] + '"></span>' +
					'   <span class="icon-cog js-popbox" data-href="{MOD_URL}&op=menu&do=topic&operation=setting&cid=' + json['cid'] + '&from=cover" data-placement="right" data-auto-adapt="true" title="'+__lang.set_up+'" data-cid="' + json['cid'] + '"><i class="glyphicon glyphicon-cog"></i></span>' +
					'    	<span class="details" title="' + json['name'] + '">' + json['name'] + '</span>'+
				'	</a>' +
				'</li>';
				
			var html1 = '<div data-cid="' + json['cid'] + '" class="list-flex list-flex-hover"  style="border-bottom: 1px solid #E3E3E3;">';
				html1 +='<div class="list-flex1">';
					html1 +='<a class="color-list-icon" href="javascript:;" style="background-color: #FFF;" title="'+__lang.cover+'">';                               
						if(json['path']) {
							html1 += '    <img  onload="setImage(this,20,20);" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=512&height=512&path=' + json['path'] + '" />';
						} else {
							html1 += '    <img onload="setImage(this,20,20);" src="dzz/images/b.gif" />';
						}                                 
                   	html1 +='</a>';
                   
                   	html1 +='<a class="color-list-text" href="{MOD_URL}&op=list&cid=' + json['cid'] + '" title="$value[metadata]" target="_blank">' + json['name'] + '</a>';
                   html1 +='	<span class="icon-sm icon-star icon-star-sm js-star-board js-star" title="'+__lang.star_sign_or_cancel+'" data-cid="' + json['cid'] + '"></span>';
				html1 +='</div>';
				html1 +='<div class="list-flex2">'+__lang.privately_owned+'</div>';
				html1 +='<div class="list-flex3">';
					html1 +='<span class="icon-cog js-popbox" data-href="{MOD_URL}&op=menu&do=topic&operation=setting&cid=' + json['cid'] + '&from=cover" data-placement="left" data-auto-adapt="true"  title="'+__lang.set_up+'" data-cid="' + json['cid'] + '"><i class="glyphicon glyphicon-cog"></i></span>';
				html1 +='</div>';			
			html1 +='</div>';				
				var el = jQuery(html).insertAfter('#board_list_' + json['orgid'] + ' .js-add-board').find('.js-popbox').popbox();
				jQuery(html1).prependTo('#board_table_' + json['orgid']).find('.js-popbox').popbox();
				jQuery('.js-popbox').each(function() {
					jQuery(this).popbox();
				});
			} else {
				showmessage(__lang.import_failure, 'danger', 0, 1);
			}
		}, function() {
			showmessage(__lang.check_whether_the_network_is_normal, 'danger', 3000, 1);
		}, 5000);
	}
	jQuery('#fileupload_import').fileupload({
			url: '{MOD_URL}&op=ajax&do=importupload_book',
			dataType: 'json',
			autoUpload: true,
			maxFileSize: 204800000, // 200 MB
			maxChunkSize: 2000000, //2M
			acceptFileTypes: new RegExp("(\.|\/)([epub|txt])$", 'i'),
			dropZone: jQuery('#popbox_import'),
			dropZone: jQuery('#popbox_import'),
			sequentialUploads: true,

		}).on('fileuploaddone', function(e, data) {
			jQuery.each(data.result.files, function(index, file) {

				if(file.error) {
					jQuery('#popbox_import .uploadmessage').html('<p class="text-danger">' + file.error + '</div>');
					showmessage(file.error, 'danger', 3000, 1);
				}
				if(file.data) {
					jQuery('#popbox_import .uploadmessage').html('<p class="text-success">'+__lang.import_success+'!</div>');
					jQuery('#popbox_import input[name="aid"]').val(file.data.aid).data('filename', file.data.filename).trigger('onchange');
				}
			});

		}).on('fileuploadprogress', function(e, data) {
			var index = 0; //data.index,
			var node = jQuery('#popbox_import .uploadmessage').find('.progress');
			if(!node.length) {
				jQuery('#popbox_import .uploadmessage').html('<div class="progress"><div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%"><span class="sr-only">0% Complete (success)</span></div></div>');
				node = jQuery('#popbox_import .uploadmessage').find('.progress');
			}
			var progress = parseInt(data.loaded / data.total * 100, 10);
			node.find('.progress-bar').css(
				'width',
				progress + '%'
			)
		})
		.on('fileuploadprocessalways', function(e, data) {
			var index = data.index,
				file = data.files[index];
			if(file.error) {
				jQuery('#popbox_import .uploadmessage').html('<span class="text-danger">' + file.error + '</span>');
			}
		});
</script>
<!--{elseif $do=='newcorpus'}-->
<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-weight:normal;font-size:20px;"></button>
	<h3>{lang create_corpus}</h3>
</div>

	<div class="popbox-body" style="width:300px;padding:15px">
	<!--{if $setting[maxcorpus] || $_G['adminid']}-->
	<!--{if $newperm[new]}-->
	<form class="form " id="newcorpus_form" role="form" method="post" action="{MOD_URL}&op=menu&do=newcorpus" onsubmit="return newcorpus_submit(this);">
	  <p id="return_newcorpus" class="text-danger "></p>
		<input type="hidden" name="handlekey" value="newcorpus" />
		<input type="hidden" name="newcorpussubmit" value="true" />
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<input type="hidden" name="orgid" value="$orgid" />

		<div class="form-group">
			<label>{lang corpus_name}</label>
			<input type="text" name="name" class="form-control">
		</div>

		<div class="form-group">
			<label>{lang cover_color}</label>
			<input id="newcorpus_color" type="hidden" name="color" value="$value[color]" />
			<div class="clearfix">
				<!--{loop $colorarr $val}-->
				<span class="color-label text-center" style="background-color: $val;" data-color="$val"></span>
				<!--{/loop}-->
			</div>
		</div>
		<div class="form-group">
			<div id="newcorpus_cover_container" class="clearfix">
				<label>{lang cover_image}</label>
				<input id="newcorpus_cover_1" name="cover" type="hidden" value="0" />
				<div id="newcorpus_cover_preview_1" style="position:relative;margin-bottom:10px;">
					<!--{if $corpus[cover]}--><img class="thumbnail" style="margin-bottom:0;max-with:150px;max-height:200px;" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=150&height=200&path={eval echo dzzencode('attach::'.$corpus[cover]);}" />
					<a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="{lang remove_logo_image}" onclick="remove_backround_url_1()"></a>
					<!--{/if}-->
				</div>
				<div id="newcorpus_cover_upload_1" class="addPhotoBar" style="position:relative;padding:10px;border:1px dashed #e1e1e1;overflow:hidden">
					<div class="uploadwrap"><input id="newcorpus_fileupload_1" type="file" name="files[]" multiple accept="image/png,image/gif,image/jpeg"></div>
					<div class="addbtn">
						<i class="glyphicon glyphicon-plus"></i> {lang cover_image_size}
					</div>
				</div>
			</div>
		</div>
		<div class="form-group">
			<button id="newcorpussubmit_btn" type="submit" class="btn btn-success" style="width:110px" data-loading-text="{lang save_in_the}">{lang create}</button>
			<button class="js-popbox btn btn-info book-importer" data-href="{MOD_URL}&op=menu&do=import&orgid=$orgid">{lang import_from_Ebooks}</button>	
		</div>
	</form>
	<!--{else}-->
		<div class="form-group">
			<label class="text-center text-danger">{lang no_privilege}</label>
			<div class="help-block">
				$errmsg
			</div>
		</div>
	<!--{/if}-->
  <!--{else}-->管理员已关闭新建文集功能
  <!--{/if}-->
	</div>



<script type="text/javascript" reload="1">
	jQuery(document).ready(function(e) {
		if(converting > 0) {
			jQuery('#newcorpus_form .book-importer').addClass('disabled').prop('disabled')
		}
		jQuery('#newcorpus_form .color-label').on('click', function() {
			jQuery('#newcorpus_form .color-label').html('');
			jQuery('#newcorpus_color').val(jQuery(this).data('color'));
			jQuery(this).html('<i class="icon-white glyphicon glyphicon-ok"></i>');
			return false;
		});
		jQuery('#newcorpus_form .js-select').on('click', function() {
			if(jQuery(this).hasClass('disabled')) return false;
			jQuery('#newcorpus_form .js-select span.select').removeClass('glyphicon-ok');
			jQuery(this).find('.select').addClass('glyphicon-ok');
			switch(jQuery(this).attr('name')) {
				case 'private':
					jQuery('#newcorpus_privacy').val('0');
					break;
				case 'org':
					jQuery('#newcorpus_privacy').val('1');
					break;
				case 'public':
					jQuery('#newcorpus_privacy').val('2');
					break;
			}
			return false;
		});
	});
	jQuery('#newcorpus_fileupload_1').fileupload({
		url: '{MOD_URL}&op=ajax&do=imageupload',
		dataType: 'json',
		autoUpload: true,
		maxFileSize: null, // 2 MB
		maxChunkSize: 2000000, //2M
		acceptFileTypes: new RegExp("(\.|\/)([jpeg|jpg|gif|png|bmp])$", 'i'),
		dropZone: jQuery('#newcorpus_cover_container'),
		dropZone: jQuery('#newcorpus_cover_container'),
		sequentialUploads: true,

	}).on('fileuploaddone', function(e, data) {
		jQuery.each(data.result.files, function(index, file) {
			jQuery('#newcorpus_cover_preview_1').html('<img class="thumbnail" style="margin-bottom:0;max-width:150px;max-height:200px;" src="' + file.data.img + '" /><a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="'+__lang.remove_cover_image+'" onclick="remove_backround_url_newcorpus(this)"></a>');
			jQuery('#newcorpus_cover_1').val(file.data.aid);
		});
	});

	function remove_backround_url_newcorpus(obj) {
		jQuery('#newcorpus_cover_preview_1').empty();
		jQuery('#newcorpus_cover_1').val('');
	}

	function newcorpus_submit(form) {
		if(form.name.value == '') {
			form.name.focus();
			return false;
		}
		jQuery('#newcorpussubmit_btn').button('loading');
		ajaxpost('newcorpus_form', 'return_newcorpus', 'return_newcorpus');
	}

	function succeedhandle_newcorpus(url, message, values) {
		console.log(values);
		jQuery('.popbox .popbox-header .close').trigger('click');
		var html = '<li class="" data-cid="' + values['cid'] + '"><span class="item-guide perm_'+values['perm']+'"> </span>' +
			
			'	<a class="js-open-board highlight-icon color-white" href="{MOD_URL}&op=list&cid=' + values['cid'] + '" style="  background-color: ' + values['color'] + '; " target="_blank">';
		if(values['path']) {
			html += '    <img class="cover" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=512&height=512&path=' + values['path'] + '" onload="setImage(this,150,200);">';
		} else {
			html += '    <img class="cover" src="dzz/images/b.gif" onload="setImage(this,150,200);">';
		}
		html += '  <span class="fade"></span>' +
			'   <span class="unread-indicator js-unread" title="'+__lang.new_change+'"></span>' +
			'   <span class="icon-sm icon-star js-star-board icon-star-sm js-star js-star" title="'+__lang.star_sign_or_cancel+'" data-cid="' + values['cid'] + '"></span>' +
			'   <span class="icon-cog js-popbox" data-href="{MOD_URL}&op=menu&do=topic&operation=setting&cid=' + values['cid'] + '&from=cover" data-placement="right" data-auto-adapt="true" title="'+__lang.set_up+'" data-cid="' + values['cid'] + '"><i class="glyphicon glyphicon-cog"></i></span>' +
			'    	<span class="details" title="' + values['name'] + '">' + values['name'] + '</span>'

		+
		'	</a>' +
		'</li>';
		var html1 = '<div data-cid="' + values['cid'] + '" class="list-flex list-flex-hover"  style="border-bottom: 1px solid #E3E3E3;">';
			html1 +='<div class="list-flex1">';
				html1 +='<a class="color-list-icon" href="javascript:;" style="background-color: ' + values['color'] + ';" title="'+__lang.cover+'">';                               
					if(values['path']) {
						html1 += '    <img onload="setImage(this,20,20);" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=512&height=512&path=' + values['path'] + '" />';
					} else {
						html1 += '    <img onload="setImage(this,20,20);" src="dzz/images/b.gif" />';
					}                                 
               	html1 +='</a>';
               
               	html1 +='<a class="color-list-text" href="{MOD_URL}&op=list&cid=' + values['cid'] + '" title="$value[metadata]" target="_blank">' + values['name'] + '</a>';
               html1 +='	<span class="icon-sm icon-star icon-star-sm js-star-board js-star" title="'+__lang.star_sign_or_cancel+'" data-cid="' + values['cid'] + '"></span>';
			html1 +='</div>';
			html1 +='<div class="list-flex2">'+__lang.privately_owned+'</div>';
			html1 +='<div class="list-flex3">';
				html1 +='<span class="icon-cog js-popbox" data-href="{MOD_URL}&op=menu&do=topic&operation=setting&cid=' + values['cid'] + '&from=cover" data-placement="left" data-auto-adapt="true"  title="'+__lang.set_up+'" data-cid="' + values['cid'] + '"><i class="glyphicon glyphicon-cog"></i></span>';
			html1 +='</div>';			
		html1 +='</div>';
		jQuery(html).insertAfter('#board_list_' + values['orgid'] + ' .js-add-board');
		jQuery('#board_table_' + values['orgid']).prepend(html1);
		jQuery('.js-popbox').each(function() {
			jQuery(this).popbox();
		});
	};
</script>
<!--{elseif $do=='settings'}-->
<!--{if $_GET['action']=='basic'}-->
<style>
	.colors a {
		float: left;
		margin: 5px;
		border: 1px solid #e1e1e1;
		border-radius: 3px;
		padding: 15px;
	}

	.colors a:hover {
		border-color: #da552f;
	}

	.colors a.active {
		border-color: #da552f;
	}
</style>
<div class="popbox-header">
	<!--{if $_GET['list']}--><button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<!--{/if}-->
	<button class="close fa fa-remove" style="font-weight:normal;font-size:20px;"></button>
	<h3>{lang base_setting}</h3>
</div>
<div class="popbox-body" style="width:300px;">
	<div style="margin-bottom:10px;">
		<input id="title_1" class="form-control input-lg focus" autocomplete="off" name="title" value="$org[name]" placeholder="{lang group_name}" onchange="setSave('name',this.value,'$orgid')" />
	</div>
	<div style="margin-bottom:20px;">
		<textarea id="desc_1" class="form-control" onchange="setSave('desc',this.value,'$orgid')" rows="3" name="desc" placeholder="{lang group_profile}">$org[desc]</textarea>
	</div>

	<div id="cover_container_logo" class="clearfix" style="margin-bottom:20px;">
		<label>{lang logo_image}</label>
		<input id="logo_1" name="logo" type="hidden" value="$org[logo]" onchange="setSave('logo',this.value,'$orgid')" />
		<div id="logo_preview_1" style="position:relative;margin-bottom:10px;">
			<!--{if $org[logo]}--><img class="thumbnail" style="margin-bottom:0;max-width:128px;max-height:128px;" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=250&height=100&path={eval echo dzzencode('attach::'.$org[logo]);}" />
			<a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="{lang remove_logo_image}" onclick="remove_backround_url_logo()"></a>
			<!--{/if}-->
		</div>
		<div id="logo_upload_1" class="addPhotoBar" style="position:relative;padding:10px;border:1px dashed #e1e1e1;overflow:hidden">
			<div class="uploadwrap"><input id="fileupload_logo" type="file" name="files[]" multiple accept="image/png,image/gif,image/jpeg"></div>
			<div class="addbtn">
				<i class="fa fa-upload"></i>{lang upload_pictures_size}
			</div>
		</div>
	</div>
	<div id="cover_container" class="clearfix" style="">
		<label>{lang banner_image}</label>
		<input id="cover_1" name="cover" type="hidden" value="$org[cover]" onchange="setSave('cover',this.value,'$orgid')" />
		<div id="cover_preview_1" style="position:relative;margin-bottom:10px;">
			<!--{if $org[cover]}--><img class="thumbnail" style="margin-bottom:0;max-width:250px;max-height:200px;" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=250&height=200&path={eval echo dzzencode('attach::'.$org[cover]);}" />
			<a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="{lang remove_logo_image}" onclick="remove_backround_url_1()"></a>
			<!--{/if}-->
		</div>
		<div id="cover_upload_1" class="addPhotoBar" style="position:relative;padding:10px;border:1px dashed #e1e1e1;overflow:hidden">
			<div class="uploadwrap"><input id="fileupload_1" type="file" name="files[]" multiple accept="image/png,image/gif,image/jpeg"></div>
			<div class="addbtn">
				<i class="fa fa-upload"></i>{lang upload_pictures_size_big}
			</div>
		</div>
	</div>

</div>

<script type="text/javascript" reload="1">
	jQuery('#title_1,#desc_1').on('keyup', function(e) {
		if(this.id == 'title_1' && this.value == '') {
			showmessage(__lang.the_group_name_cannot_be_empty, 'danger', 3000, 1);
		} else {
			jQuery('#org_' + this.id.replace(/_1/i, '')).text(this.value);
		}
	});

	function remove_backround_url_logo(obj) {
		jQuery('#logo_preview_1').empty();
		jQuery('#logo_1').val('').trigger('onchange');
		jQuery('#org_header .org-logo-wrapper').hide();

		return false;
	}

	function remove_backround_url_1(obj) {
		jQuery('#cover_preview_1').empty();
		jQuery('#cover_1').val('').trigger('onchange');
		jQuery('#org_header').removeClass('cover').css('background-image', 'none');

		return false;
	}

	jQuery('#fileupload_logo').fileupload({
		url: '{MOD_URL}&op=ajax&do=imageupload',
		dataType: 'json',
		autoUpload: true,
		maxFileSize: null, // 2 MB
		maxChunkSize: 2000000, //2M
		acceptFileTypes: new RegExp("(\.|\/)([jpeg|jpg|gif|png|bmp])$", 'i'),
		dropZone: jQuery('#org_header .org-logo-wrapper,#cover_container_logo'),
		dropZone: jQuery('#org_header .org-logo-wrapper,#cover_container_logo'),
		sequentialUploads: true,

	}).on('fileuploaddone', function(e, data) {
		jQuery.each(data.result.files, function(index, file) {
			jQuery('#logo_preview_1').html('<img class="thumbnail" style="margin-bottom:0;max-width:128px;max-height:128px;" src="' + file.data.img + '" /><a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="'+__lang.remove_logo_image+'" onclick="remove_backround_url_1()"></a>');
			jQuery('#logo_1').val(file.data.aid).trigger('onchange');
			jQuery('#org_header .org-logo-wrapper').show().css('background-image', "url(" + (file.data.img) + ")");
			//setImage(document.getElementById('imgbg'),jQuery('#header').outerWidth(true),jQuery('#header').outerHeight(true));
		});
	});
	jQuery('#fileupload_1').fileupload({
		url: '{MOD_URL}&op=ajax&do=imageupload',
		dataType: 'json',
		autoUpload: true,
		maxFileSize: null, // 2 MB
		maxChunkSize: 2000000, //2M
		acceptFileTypes: new RegExp("(\.|\/)([jpeg|jpg|gif|png|bmp])$", 'i'),
		dropZone: jQuery('#org_header,#cover_container'),
		dropZone: jQuery('#org_header,#cover_container'),
		sequentialUploads: true,

	}).on('fileuploaddone', function(e, data) {
		jQuery.each(data.result.files, function(index, file) {
			jQuery('#cover_preview_1').html('<img class="thumbnail" style="margin-bottom:0;max-width:250px;max-height:200px;" src="' + file.data.img + '" /><a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="'+__lang.remove_banner_image+'" onclick="remove_backround_url_1()"></a>');
			jQuery('#cover_1').val(file.data.aid).trigger('onchange');
			jQuery('#org_header').show().css('background-image', "url(" + (file.data.img+'&original=1') + ")");
			jQuery('#org_header').addClass('cover');
			//setImage(document.getElementById('imgbg'),jQuery('#header').outerWidth(true),jQuery('#header').outerHeight(true));
		});
	});
</script>
<!--{/if}-->
<!--{elseif $do=='org_member_role'}-->

<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_org_u_role">{lang change_the_permissions}</h3>
</div>

<form id="form_org_u_role" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=org_member_role" onsubmit="return org_u_role_submit(this);">
	<input type="hidden" name="handlekey" value="org_u_role" />
	<input type="hidden" name="org_u_rolesubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="orgid" value="$orgid" />
	<input type="hidden" id="org_user_perm" name="perm" value="$org[perm]" />
	<div id="popbox_org_u_role" class="popbox-body" style="max-width:270px;padding:10px">
		<ul class="popbox-list u-bottom list-unstyled">
			<!--{loop $permtitle $key $title}-->
			<li>
				<!--{if $_G['uid']==$uid && $org['perm']>2 && $key<3 && $org['adminsum']>1}-->
				<a class="js-popbox" data-href="{MOD_URL}&op=menu&do=org_member_role_confirm&orgid=$orgid&uid=$value[uid]&perm=$key" href="javascript:;">
				<!--{else}-->
				</a><a class="js-select <!--{if $org['perm']==$key || ($org['perm']>2 && $org['adminsum']<2)}--> disabled<!--{/if}-->" href="#" perm="$key">
				<!--{/if}-->
					$title
					<span class="select icon-sm glyphicon <!--{if $org['perm']==$key}--> glyphicon-ok disabled<!--{/if}-->"></span>
					<span class="sub-name">
          <!--{if $key==3}-->{lang can_view_create_edit_group}
          <!--{elseif $key==2}-->{lang can_view_create_edit_cannot_modify_group_settings}
            <!--{elseif $key==1}-->{lang you_can_only_view_the_collection_group}
            <!--{/if}-->
          </span>
				</a>
			</li>
			<!--{/loop}-->
			<!--{if $org['perm']>2 && $org['adminsum']<2}-->
			<li class="divider"></li>
			<li>
				<span class="quiet u-bottom help-block "><i class="glyphicon glyphicon-exclamation-sign text-warning"></i> {lang cannot_modify_this_user_permission}</span>
			</li>
			<!--{/if}-->
		</ul>
	</div>
</form>
<script type="text/javascript">
	jQuery('#popbox_org_u_role .js-select').on('click', function() {
		if(jQuery(this).hasClass('disabled')) return false;
		jQuery('#org_user_perm').val(jQuery(this).attr('perm'));
		org_u_role_submit();
	});

	function org_u_role_submit(form) {
		ajaxpost('form_org_u_role', 'return_org_u_role', 'return_org_u_role');
	}

	function succeedhandle_org_u_role(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		var item = jQuery('.member-list-item-detail[data-uid="' + values['uid'] + '"]');
		item.attr('data-perm', values['perm']).find('.member-type').attr('title', values['permtitle']);
		item.find('.js-change-role').html(values['permtitle'] + ' <span class="caret"></span>');
		if(values['perm'] > 2) {
			item.find('.member-type').addClass('admin');
		} else {
			item.find('.member-type').removeClass('admin');
		}
		try {
			check_admin();
		} catch(e) {}
	};
</script>
<!--{elseif $do=='org_member_role_confirm'}-->

<div class="popbox-header text-center">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev" style="font-size:16px;font-weight:normal"></button>
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_org_role_lost_confirm">{lang remove_administrative_permissions}</h3>
</div>

<form id="form_org_role_lost_confirm" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=org_member_role_confirm" onsubmit="return org_role_lost_confirm_submit(this);">
	<input type="hidden" name="handlekey" value="org_role_lost_confirm" />
	<input type="hidden" name="org_role_lost_confirmsubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="orgid" value="$orgid" />
	<input type="hidden" name="perm" value="$tperm" />
	<div class="popbox-body" style="max-width:250px;padding:10px">
		<p class="help-block">{lang lose_all_administrative_privileges_group}</p>
		<button class="btn btn-danger btn-block" type="submit">{lang sure_lose_all_administrative_privileges}</button>
	</div>
</form>
<script type="text/javascript">
	function org_role_lost_confirm_submit(form) {
		ajaxpost('form_org_role_lost_confirm', 'return_org_role_lost_confirm', 'return_org_role_lost_confirm');
		return false;
	}

	function succeedhandle_org_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		jQuery('#members_1').load('{MOD_URL}&op=org&do=members&orgid=$orgid&t=' + new Date().getTime());
	};
</script>
<!--{elseif $do=='org_member_remove'}-->

<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_org_member_remove">{lang remove_rembers}</h3>
</div>

<form id="form_org_member_remove" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=org_member_remove" onsubmit="return org_member_remove_submit(this);">
	<input type="hidden" name="handlekey" value="org_role_lost_confirm" />
	<input type="hidden" name="org_member_removesubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="orgid" value="$orgid" />
	<div class="popbox-body" style="max-width:250px;padding:10px">
		<p class="help-block">{lang you_remove_the_user_from_the_group}</p>
		<button class="btn btn-danger btn-block" type="submit"><!--{if $uid==$_G['uid']}-->{lang leaving}<!--{else}-->{lang remove_users}<!--{/if}--></button>
	</div>
</form>
<script type="text/javascript">
	function org_member_remove_submit(form) {
		ajaxpost('form_org_member_remove', 'return_org_member_remove', 'return_org_member_remove');
		return false;
	}

	function succeedhandle_org_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		if(values['uid'] == '$_G[uid]') {
			window.location.href = "{MOD_URL}";
		} else {
			jQuery('#members_1').load('{MOD_URL}&op=org&do=members&orgid=$orgid&t=' + new Date().getTime());
		}
	};
</script>
<!--{elseif $do=='org_member_add'}-->

<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3>{lang add_user}</h3>
</div>
<div id="popbox_org_member_add" class="popbox-body" style="width:300px;padding:10px">
	<div class="search-with-spinner">
		<input class="form-control js-search-input js-autofocus" type="text" style="margin-bottom: 0;" placeholder="">
		<div class="spinner small js-loading" style=" display: none; "><img src="dzz/corpus/images/spinner.gif" /></div>
	</div>
	<div class="manage-member-section js-helper help-block">
		<p class="u-bottom quiet" style="padding: 6px;">{lang enter_user_name_or_mailbox_keyword_search}</p>
	</div>
	<div class="manage-member-section js-error zhide">
		<h4>Error</h4>
		<p class="text-danger">The user or email could not be invited due to an organization restriction.</p>
	</div>
	<div class="manage-member-section zhide js-uninvited-search-results">
		<p class="quiet"><strong class="js-email-tip"></strong>? 没有找到此邮箱的用户！<br />您可以发送邀请,系统将添加此用户为未激活状态，当用户接受邀请，并且完成注册后将自动获得此小组的权限</p>
		<p class="text-danger zhide js-name-error"></p>
		<form class="js-email-data" onsubmit="return js_send_email_submit(this)">
			<input type="hidden" name="orgid" value="$orgid" />
			<label>用户名</label>
			<p><input class="form-control js-autofocus js-full-name" name="username" type="text" value=""></p>
			<input class="js-email" name="email" type="hidden" value="">
			<button class="btn btn-primary btn-width js-send-email-invite" type="submit" data-loading-text="发送中，请稍候...">发送邀请</button>
		</form>
	</div>
	<div class="manage-member-section zhide js-search-results">
		<h4>{lang choice_add}</h4>
		<ul class="popbox-member-list options js-list list-unstyled"></ul>
	</div>
	<div class="manage-member-section js-no-results zhide">
		<p class="quiet text-center" style="padding: 16px 4px;">{lang no_relevant_results}</p>
	</div>
</div>

<script type="text/javascript">
	jQuery('#popbox_org_member_add .js-autofocus').focus();
	jQuery(document).on('mouseover', '.js-member-item', function() {
		jQuery(this).addClass('selected');
	});
	jQuery(document).on('mouseout', '.js-member-item', function() {
		jQuery(this).removeClass('selected');
	});
	var search_timer = 0;
	jQuery(document).on('keyup', '.js-search-input', function() {
		var term = this.value;
		if(term == '') {
			if(search_timer) window.clearTimeout(search_timer);
			manage_member_section_show(['js-helper']);
		} else {
			if(search_timer) window.clearTimeout(search_timer);
			search_timer = window.setTimeout(function() {
				member_add_search(term);
			}, 500);
		}

	});
	jQuery(document).on('click', '.js-member-item:not(.disabled) .js-select-member', function() {
		var uid = jQuery(this).attr('uid');
		jQuery.post('{MOD_URL}&op=ajax&do=org_member_add', {
			"orgid": '$orgid',
			"uid": uid
		}, function(json) {
			if(json.msg == 'success') {
				jQuery('#popbox_org_member_add .js-search-input').val('').focus();
				manage_member_section_show(['js-helper']);
				jQuery('#members_1').load('{MOD_URL}&op=org&do=members&orgid=$orgid&t=' + new Date().getTime());
			} else {
				showmessage(json.error, 'danger', 3000, 1);
			}
		}, 'json');
		return false;
	});

	function member_add_search(term) {
		jQuery('#popbox_org_member_add .js-loading').show();
		jQuery.post('{MOD_URL}&op=ajax&do=search_user_list', {
			"orgid": '$orgid',
			'term': term
		}, function(json) {
			if(json.num > 0) {
				var html = '';
				for(var i = 0; i < json.list.length; i++) {
					html += ' <li class="item js-member-item ' + (json.list[i].joined ? 'disabled' : (json.list[i].lastactivity < 1 ? 'inactive' : '')) + '">';
					html += '		<a  class="name js-select-member ' + ((json.list[i].joined || json.list[i].lastactivity < 1) ? 'multi-line' : '') + '" href="#" uid="' + json.list[i].uid + '" title="' + json.list[i].username + '">';
					
					

					html += json.list[i].avatar_block  + json.list[i].username;





					if(json.list[i].joined) {
						html += '			<div class="extra-text quiet">'+__lang.added+'</div>';
					}
					html += '	    </a>';
					html += '	</li>';
				}
				jQuery('#popbox_org_member_add .js-list').html(html);
				manage_member_section_show(['js-search-results']);
			//} else if(json.isemail) {
				//var form = jQuery('#popbox_org_member_add .js-email-data');
				//jQuery('#popbox_org_member_add .js-email-tip').html(json.term);
				//form.find('.js-full-name').val(json.username);
				//form.find('.js-email').val(json.term);
				//manage_member_section_show(['js-uninvited-search-results']);
			} else {
				manage_member_section_show(['js-no-results']);
			}
			jQuery('#popbox_org_member_add .js-loading').hide();
		}, 'json');
	}

	function manage_member_section_show(classarr) {
		jQuery('#popbox_org_member_add .manage-member-section').each(function() {
			var have = 0;
			for(var i = 0; i < classarr.length; i++) {
				if(jQuery(this).hasClass(classarr[i])) {
					have = 1;
					break;
				}
			}
			if(have) {
				jQuery(this).removeClass('zhide');
			} else {
				jQuery(this).addClass('zhide');
			}
		});
	}

	function js_send_email_submit(form) {

		jQuery(form).find('.js-send-email-invite').button('loading');
		jQuery.post('{MOD_URL}&op=ajax&do=member_invite', jQuery(form).serialize(), function(json) {

			if(json.msg == 'success') {
				jQuery('#members_1').load('{MOD_URL}&op=org&do=members&orgid=$orgid&t=' + new Date().getTime());
				jQuery('.popbox .popbox-header .close').trigger('click');
			} else if(json.error) {

				jQuery(form).find('.js-send-email-invite').button('reset');
				jQuery('#popbox_org_member_add .js-name-error').html(json.error).show();
			}
		}, 'json');
		return false;
	}

	function succeedhandle_org_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		if(values['uid'] == '$_G[uid]') {
			window.location.href = "{MOD_URL}";
		} else {
			jQuery('#members_1').load('{MOD_URL}&op=org&do=members&orgid=$orgid&t=' + new Date().getTime());
		}
	};
</script>
<!--{elseif $do=='member_add'}-->

<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3>{lang add_user}</h3>
</div>
<div id="popbox_member_add" class="popbox-body" style="width:300px;padding:10px">
	<!--{if !$org[inviteperm]}-->
	<div class="search-with-spinner">
		<input class="form-control js-search-input js-autofocus" type="text" style="margin-bottom: 0;" placeholder="">
		<div class="spinner small js-loading" style=" display: none; "><img src="dzz/corpus/images/spinner.gif" /></div>
	</div>
	<div class="manage-member-section js-helper help-block">
		<p class="u-bottom quiet" style="padding: 6px;">{lang enter_user_name_or_mailbox_keyword_search}</p>
	</div>

	<div class="manage-member-section js-error zhide">
		<h4>Error</h4>
		<p class="text-danger">The user or email could not be invited due to an organization restriction.</p>
	</div>
	
	<!--{/if}-->
	<!--{if $orgmembers}-->
	<div class="manage-member-section  js-org-members" style="margin-top:0">

		<ul class="popbox-member-list options js-list list-unstyled">
			<!--{loop $orgmembers $value}-->
			<li class="item js-member-item">
				<a class="name js-select-member " href="#" uid="$value[uid]" title="$value[username]">
				{eval echo avatar_block($value['uid'],null,'iconFirstWord');} $value[username]
				</a>
			</li>
			<!--{/loop}-->
		</ul>
	</div>

	<!--{/if}-->
	<div class="manage-member-section zhide js-search-results">
		<h4>{lang choice_add}</h4>
		<ul class="popbox-member-list options js-list list-unstyled"></ul>
	</div>
	<div class="manage-member-section js-no-results zhide">
		<p class="quiet text-center" style="padding: 16px 4px;">No results</p>
	</div>
</div>

<script type="text/javascript">
	jQuery('#popbox_member_add .js-autofocus').focus();
	jQuery(document).on('mouseover', '.js-member-item', function() {
		jQuery(this).addClass('selected');
	});
	jQuery(document).on('mouseout', '.js-member-item', function() {
		jQuery(this).removeClass('selected');
	});
	var search_timer = 0;
	jQuery(document).on('keyup', '.js-search-input', function() {
		var term = this.value;
		if(term == '') {
			if(search_timer) window.clearTimeout(search_timer);
			manage_member_section_show(['js-helper', 'js-org-members']);
		} else {
			if(search_timer) window.clearTimeout(search_timer);
			search_timer = window.setTimeout(function() {
				member_add_search(term);
			}, 500);
		}

	});
	jQuery(document).on('click', '.js-member-item:not(.disabled) .js-select-member', function() {
		var el = jQuery(this);
		var uid = el.attr('uid');
		jQuery.post('{MOD_URL}&op=ajax&do=member_add', {
			"cid": '$cid',
			"uid": uid
		}, function(json) {
			if(json.msg == 'success') {
				jQuery('#popbox_member_add .js-search-input').val('').focus();
				manage_member_section_show(['js-helper', 'js-org-members']);
				el.parent().remove();
				jQuery('#topic_container').load('{MOD_URL}&op=list&do=user&cid=$cid&t=' + new Date().getTime());
			} else {
				showmessage(json.error, 'danger', 3000, 1);
			}
		}, 'json');
		return false;
	});

	function member_add_search(term) {
		jQuery('#popbox_member_add .js-loading').show();
		jQuery.post('{MOD_URL}&op=ajax&do=search_user_list', {
			'term': term,
			"cid": '$cid'
		}, function(json) {
			if(json.num > 0) {
				var html = '';
				for(var i = 0; i < json.list.length; i++) {
					html += ' <li class="item js-member-item ' + (json.list[i].joined ? 'disabled' : (json.list[i].lastactivity < 1 ? 'inactive' : '')) + '">';
					html += '		<a  class="name js-select-member ' + ((json.list[i].joined || json.list[i].lastactivity < 1) ? 'multi-line' : '') + '" href="#" uid="' + json.list[i].uid + '" title="' + json.list[i].username + '">';
					
					

					html += json.list[i].avatar_block + json.list[i].username;
										
					
					if(json.list[i].joined) {
						html += '			<div class="extra-text quiet">'+__lang.added+'</div>';
					}
					html += '	    </a>';
					html += '	</li>';
				}
				jQuery('#popbox_member_add .js-search-results .js-list').html(html);
				manage_member_section_show(['js-search-results']);
			/*} else if(json.isemail) {
				var form = jQuery('#popbox_member_add .js-email-data');
				jQuery('#popbox_member_add .js-email-tip').html(json.term);
				form.find('.js-full-name').val(json.username);
				form.find('.js-email').val(json.term);
				manage_member_section_show(['js-uninvited-search-results']);*/
			} else {
				manage_member_section_show(['js-no-results']);
			}
			jQuery('#popbox_member_add .js-loading').hide();
		}, 'json');
	}

	function manage_member_section_show(classarr) {
		jQuery('#popbox_member_add .manage-member-section').each(function() {
			var have = 0;
			for(var i = 0; i < classarr.length; i++) {
				if(jQuery(this).hasClass(classarr[i])) {
					have = 1;
					break;
				}
			}
			if(have) {
				jQuery(this).removeClass('zhide');
			} else {
				jQuery(this).addClass('zhide');
			}
		});
	}

	function js_send_email_submit(form) {

		jQuery(form).find('.js-send-email-invite').button('loading');
		jQuery.post('{MOD_URL}&op=ajax&do=member_invite', jQuery(form).serialize(), function(json) {

			if(json.msg == 'success') {
				jQuery('#topic_container').load('{MOD_URL}&op=list&do=user&cid=$cid&t=' + new Date().getTime());
				jQuery('.popbox .popbox-header .close').trigger('click');
			} else if(json.error) {

				jQuery(form).find('.js-send-email-invite').button('reset');
				jQuery('#popbox_member_add .js-name-error').html(json.error).show();
			}
		}, 'json');
		return false;
	}

	function succeedhandle_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		jQuery('#topic_container').load('{MOD_URL}&op=list&do=user&cid=$cid&t=' + new Date().getTime());

	};
</script>
<!--{elseif $do=='member_role'}-->

<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_u_role">{lang change_the_permissions}</h3>
</div>

<form id="form_u_role" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=member_role" onsubmit="return u_role_submit(this);">
	<input type="hidden" name="handlekey" value="u_role" />
	<input type="hidden" name="u_rolesubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="cid" value="$cid" />
	<input type="hidden" id="user_perm" name="perm" value="$perm" />
	<div id="popbox_u_role" class="popbox-body" style="max-width:270px;padding:10px">
		<ul class="popbox-list u-bottom list-unstyled">
			<!--{loop $permtitle $key $title}-->
			<li>
				<!--{if $_G['uid']==$uid && $perm>2 && $key<3 && $adminsum>1}-->
				<a class="js-popbox" data-href="{MOD_URL}&op=menu&do=member_role_confirm&cid=$cid&uid=$value[uid]&perm=$key" href="javascript:;">
					<!--{else}-->
					</a><a class="js-select <!--{if $perm==$key || ($perm>2 && $adminsum<2)}--> disabled<!--{/if}-->" href="#" perm="$key">
						<!--{/if}-->
						$title
						<span class="select icon-sm glyphicon <!--{if $perm==$key}--> glyphicon-ok disabled<!--{/if}-->"></span>
						<span class="sub-name">
                    	<!--{if $key==3}-->{lang can_view_create_edit}
                    	<!--{elseif $key==2}-->{lang can_view_create_edit_cannot_modify_corpus_settings}
                        <!--{elseif $key==1}-->{lang you_can_only_view_the_collection}
                        <!--{/if}-->
                    </span>
					</a>
			</li>
			<!--{/loop}-->
			<!--{if $perm>2 && $adminsum<2}-->
			<li class="divider"></li>
			<li>
				<span class="quiet u-bottom help-block "><i class="glyphicon glyphicon-exclamation-sign text-warning"></i> {lang cannot_modify_this_user_permission}</span>
			</li>
			<!--{/if}-->
		</ul>
	</div>
</form>
<script type="text/javascript">
	jQuery('#popbox_u_role .js-select').on('click', function() {
		if(jQuery(this).hasClass('disabled')) return false;
		jQuery('#user_perm').val(jQuery(this).attr('perm'));
		u_role_submit();
	});

	function u_role_submit(form) {
		ajaxpost('form_u_role', 'return_u_role', 'return_u_role');
	}

	function succeedhandle_u_role(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		var item = jQuery('.member-list-item-detail[data-uid="' + values['uid'] + '"]');
		item.attr('data-perm', values['perm']).find('.member-type').attr('title', values['permtitle']);
		item.find('.js-change-role').html(values['permtitle'] + ' <span class="caret"></span>');
		if(values['perm'] > 2) {
			item.find('.member-type').addClass('admin');
		} else {
			item.find('.member-type').removeClass('admin');
		}
		try {
			check_admin();
		} catch(e) {}
	};
</script>
<!--{elseif $do=='member_role_confirm'}-->

<div class="popbox-header text-center">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev" style="font-size:16px;font-weight:normal"></button>
	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_role_lost_confirm">{lang remove_administrative_permissions}</h3>
</div>

<form id="form_role_lost_confirm" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=member_role_confirm" onsubmit="return role_lost_confirm_submit(this);">
	<input type="hidden" name="handlekey" value="role_lost_confirm" />
	<input type="hidden" name="role_lost_confirmsubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="cid" value="$cid" />
	<input type="hidden" name="perm" value="$tperm" />
	<div class="popbox-body" style="max-width:250px;padding:10px">
		<p class="help-block">{lang lose_all_administrative_privileges}</p>
		<button class="btn btn-danger btn-block" type="submit">{lang sure_lose_all_administrative_privileges}</button>
	</div>
</form>
<script type="text/javascript">
	function role_lost_confirm_submit(form) {
		ajaxpost('form_role_lost_confirm', 'return_role_lost_confirm', 'return_role_lost_confirm');
		return false;
	}

	function succeedhandle_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		jQuery('#topic_container').load('{MOD_URL}&op=list&do=user&cid=$cid&t=' + new Date().getTime());
	};
</script>
<!--{elseif $do=='member_remove'}-->

<div class="popbox-header text-center">

	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_member_remove">{lang remove_rembers}</h3>
</div>

<form id="form_member_remove" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=member_remove" onsubmit="return member_remove_submit(this);">
	<input type="hidden" name="handlekey" value="role_lost_confirm" />
	<input type="hidden" name="member_removesubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="uid" value="$uid" />
	<input type="hidden" name="cid" value="$cid" />
	<div class="popbox-body" style="max-width:250px;padding:10px">
		<p class="help-block">{lang system_sends_message_notification_to_the_user}</p>
		<button class="btn btn-danger btn-block" type="submit"><!--{if $uid==$_G['uid']}-->{lang leaving}<!--{else}-->{lang remove_users}<!--{/if}--></button>
	</div>
</form>
<script type="text/javascript">
	function member_remove_submit(form) {
		ajaxpost('form_member_remove', 'return_member_remove', 'return_member_remove');
		return false;
	}

	function succeedhandle_role_lost_confirm(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		if(values['uid'] == '$_G[uid]') {
			window.location.href = "{MOD_URL}";
		} else {
			jQuery('#topic_container').load('{MOD_URL}&op=list&do=user&cid=$cid&t=' + new Date().getTime());
		}
	};
</script>

<!--{elseif $do=='org_share'}-->
<div class="popbox-header">
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share}</h3>
</div>
<div class="popbox-body" style="padding:15px 18px;min-width:120px;">
	<!--{if $org['privacy']}-->
	<div class="alert alert-warning list-unstyled" style="padding:5px 10px;margin:-10px -10px 15px -10px;min-width:180px;">
		<p><span class="icon-sm icon-private fa fa-lock"></span> {lang the_private_group}</p>
		<p class="sub-name">{lang only_team_members_and_members_of_this_corpus_can_view}</p>
		<p class="danger">{lang pay_attention_to_share_objects}</p>
	</div>
	<!--{/if}-->
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-select  js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=org_shareurl&orgid=$orgid" title="{lang share_addresses_and_codes}">
				<i class="fa fa-link"></i> &nbsp;{lang address}
			</a>
		</li>
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=org_sharetowechat&orgid=$orgid" title="{lang share_to_WeChat}">
				<i class="fa fa-weixin"></i> &nbsp;{lang WeChat}
			</a>
		</li>
		<li>
			<a class="js-select" href="http://connect.qq.com/widget/shareqq/index.html?url={eval echo urlencode($shareurl);}&showcount=0&desc={eval echo rawurlencode($org[name]);}&title={eval echo rawurlencode($org[name]);}&site={eval echo rawurlencode($_G[sitename])}" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_QQ}">
				<i class="fa fa-qq"></i> &nbsp;{lang QQ_friends}
			</a>
		</li>
		<li>
			<a class="js-select" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={eval echo urlencode($shareurl);}&showcount=0&desc={eval echo rawurlencode($org[name]);}&title={eval echo rawurlencode($org[name]);}&site={eval echo rawurlencode($_G[sitename])}" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_QQ}">
				<i class="fa fa-qq"></i> &nbsp;{lang Qzone}
			</a>
		</li>
		<li>
			<a class="js-select sharetoweibo" href="http://service.weibo.com/share/share.php?title={eval echo rawurlencode($org[name]);}&url={eval echo urlencode($shareurl);}&source=bookmark&appkey=1153621900&pic=&ralateUid=" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_sina}">
				<i class="fa fa-weibo"></i> &nbsp;{lang sina_microblog}
			</a>
		</li>
	</ul>
</div>
<!--{elseif $do=='org_shareurl'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share_addresses_and_codes}</h3>
</div>
<div class="popbox-body" style="min-width:220px;">
	<!--{if $qrcode}-->
	<p class="text-center"><img class="img-thumbnail" src="$qrcode"></p>
	<!--{/if}-->
	<input type="text" class="form-control" style="cursor:default;background:#FFF" spellingcheck="false" readonly name="shareurl" value='$shareurl' onclick="this.select()">

</div>
<!--{elseif $do=='org_sharetowechat'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share_the_WeChat_friends_circle}</h3>
</div>
<div class="popbox-body" style="min-width:220px;">
	<p class="text-center"><img src="$qrcode"></p>
	<p class="help-block">{lang codes_share_the_WeChat_friends_circle}</p>
</div>
<!--{elseif $do=='org_delete'}-->

<div class="popbox-header text-center">

	<button class="close fa fa-remove" style="font-size:16px;font-weight:normal"></button>
	<h3 id="return_org_delete">{lang deletion_team_sure}</h3>
</div>

<form id="form_org_delete" class="form" role="form" method="post" action="{MOD_URL}&op=menu&do=org_delete" onsubmit="return org_delete_submit(this);">
	<input type="hidden" name="handlekey" value="org_delete" />
	<input type="hidden" name="org_deletesubmit" value="true" />
	<input type="hidden" name="formhash" value="{FORMHASH}" />
	<input type="hidden" name="orgid" value="$orgid" />
	<div class="popbox-body" style="max-width:250px;padding:10px">
		<p class="help-block">{lang the_corpus_in_the_group_will_not_be_deleted}</p>

	</div>
	<div class="popbox-footer text-right">
		<button id="form_org_delete_btn" class="btn btn-danger btn-width mr15" data-loading-text="{lang deleting}" type="submit">{lang completely_delete}</button>
		<button class="btn btn-simple  btn-width cancel" type="button">{lang cancel}</button>
	</div>
</form>
<script type="text/javascript">
	function org_delete_submit(form) {
		jQuery('#form_org_delete_btn').button('loading');
		ajaxpost('form_org_delete', 'return_org_delete', 'return_org_delete');
		return false;
	}

	function succeedhandle_org_delete(url, message, values) {
		jQuery('.popbox .popbox-header .close').trigger('click');
		window.location.href = "{MOD_URL}";
	};
</script>
<!--{elseif $do=='topic'}-->
<!--{if $operation=='import'}-->

<div class="popbox-header">
          <button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
        <h3 class="text-center">导入文档</h3>
      </div>
<div class="popbox-body" style="padding:15px 18px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-select uploadwrap" href="javascript:;" code="0" style="position:relative;overflow:hidden">
				{lang here_document}
				<input id="fileupload_import" type="file" name="files[]" multiple accept="application/epub+zip,application/vnd.openxmlformats-officedocument.wordprocessingml.document,text/plain">
				<div class="progress progress-line">
					<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
						<span class="sr-only">0% Complete (success)</span>
					</div>
				</div>
			</a>
		</li>
	</ul>
</div>
<script type="text/javascript" reload="1">
	jQuery('#fileupload_import').fileupload({
		url: '{MOD_URL}&op=ajax&do=importupload',
		dataType: 'json',
		autoUpload: true,
		maxFileSize: 20000000, // 20MB
		maxChunkSize: 2000000, //2M
		acceptFileTypes: new RegExp("(\.|\/)(CHM|MOBI|EPUB|PDF|DOCX|MD|INI|DZZDOC|HTM|HTML|SHTM|SHTML|HTA|HTC|XHTML|STM|SSI|JS|JSON|AS|ASC|ASR|XML|XSL|XSD|DTD|XSLT|RSS|RDF|LBI|DWT|ASP|ASA|ASPX|ASCX|ASMX|CONFIG|CS|CSS|CFM|CFML|CFC|TLD|TXT|PHP|JSP|WML|TPL|LASSO|JSF|VB|VBS|VTM|VTML|INC|SQL|JAVA|EDML|MASTER|INFO|INSTALL|THEME|CONFIG|MODULE|PROFILE|ENGINE)$", 'i'),
		sequentialUploads: true,
	}).on('fileuploadprogress', function(e, data) {
		var index = 0; //data.index,
		var node = jQuery('#fileupload_import').parent().find('.progress-line');
		var progress = parseInt(data.loaded / data.total * 100, 10);
		node.find('.progress-bar').css(
			'width',
			progress + '%'
		);
	}).on('fileuploaddone', function(e, data) {
		jQuery.each(data.result.files, function(index, file) {
			if(file.error) {
				showmessage(file.error, 'danger', 3000, 1);
			} else {
				window.setTimeout(function() {
					jQuery('.js-popbox .openpop').popbox('close');
				}, 500);
				showmessage('<img src="dzz/corpus/images/loading.gif" height="16" />'+__lang.upload_completed_waiting, 'info', 0, 1);
				jstree_import_doc(file.data);
			}
		});
	}).on('fileuploadprocessalways', function(e, data) {
		var index = data.index,
			file = data.files[index];
		if(file.error) {
			showmessage(file.error, 'danger', 3000, 1);
		}
	});
</script>
<!--{elseif $operation=='rss'}-->
<form id="rss_import" action="{MOD_URL}&op=rss_import" method="post" onsubmit="return rss_import_submit(this)">
	<div class="popbox-header">
		<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
		<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
		<h3 class="text-center">{lang RSS_leading_in}</h3>
	</div>
	<div class="popbox-body" style="padding:15px 18px;min-width:220px;max-height:400px;overflow-y:auto;overflow-x:hidden">
		<input type="hidden" name="handlekey" value="rss_import" />
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<div class="form-group">
			<input id="rss_import_input" class="form-control js-autofocus" type="text" name="rss" placeholder="{lang RSS_address}">
			<span class="help-block">{lang RSS_content_tags}</span>
		</div>

	</div>
	<div class="popbox-footer text-right">
		<button id="rss_import_btn" class="btn btn-primary btn-width mr15" data-loading-text="{lang leading_in}" type="submit">{lang start_importing}</button>
		<button class="btn btn-simple  btn-width cancel" type="button">{lang cancel}</button>
	</div>
</form>
<script type="text/javascript" reload="1">
	jQuery('#rss_import .js-autofocus').focus();

	function rss_import_submit(form) {
		if(form.rss.value == '') {
			form.rss.focus();
			showmessage(__lang.input_RSS_address, 'danger', 300, 1);
			return false;
		}
		jQuery('#rss_import_btn').button('loading');
		jstree_import_from_rss(form.rss.value);
		return false;
	}
</script>
<!--{elseif $operation=='evernote'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-center">{lang evernote}</h3>
</div>
<div class="popbox-body" style="padding:15px 18px;min-width:180px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<!--{if $notes}-->
		<!--{loop $notes $value}-->
		<li>
			<a class="js-select js-popbox" data-href="{MOD_URL}&op=menu&do=topic&operation=evernote_notes&id=$value[id]" style="position:relative;padding-right:30px">
				{eval echo $value['International']?lang('international_edition'):lang('watchabc');}lang('user_ID'):$value['userId']
				<i class="js-oauth-remove small ibtn ibtn-sm glyphicon glyphicon-trash" data-id="$value[id]" style="position:absolute;right:5px;top:7px;" title="{lang delete_license}"></i>
			</a>
		</li>
		<!--{/loop}-->
		<li class="divider"></li>
		<!--{/if}-->
		<li>
			<a class="js-select" href="{MOD_URL}&op=evernote&do=bind" target="_blank" onclick="jQuery('.popbox .js-popbox-prev').trigger('click');">
				{lang add_new_authorization}({lang watchabc})
			</a>
		</li>
		<li>
			<a class="js-select" href="{MOD_URL}&op=evernote&do=bind&International=1" target="_blank" onclick="jQuery('.popbox .js-popbox-prev').trigger('click');">
				{lang add_new_authorization}({lang international_edition})
			</a>
		</li>

	</ul>
</div>
<script type="text/javascript">
	jQuery('.js-oauth-remove').off().on('click', function() {
		var el = jQuery(this);
		jQuery.post('{MOD_URL}&op=evernote&do=unbind', {
			'id': el.data('id')
		}, function(json) {
			if(json.msg == 'success') el.closest('li').remove();
			else showmessage(json.error, 'danger', 3000, 1);
		}, 'json');
		return false;
	});
</script>
<!--{elseif $operation=='evernote_notes'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-center">{lang select_notes}</h3>
</div>
<div class="popbox-body" style="padding:15px 18px;min-width:200px;max-height:400px;overflow-y:auto;overflow-x:hidden">
	<form id="evernote_list_$id" action="{MOD_URL}&op=evernote&do=notes" method="post" onsubmit="return false">
		<input type="hidden" name="formhash" value="{FORMHASH}" />
		<input type="hidden" name="id" value="$id" />
		<div class="form-group">
			<div class="search-with-spinner">
				<input class="form-control js-autofocus js-search-evernote-input" type="text" name="keyword" style="margin-bottom: 0;" placeholder="{lang keyword_search}">
				<div class="spinner small js-loading" style=" display: none; "><img src="dzz/corpus/images/spinner.gif"></div>
			</div>
		</div>
		<ul class="popbox-menu js-list u-bottom list-unstyled search-with-spinner" style="margin-top:0">
			<div class="loadding"></div>
			<li>
				<a href="javascript:;">{lang inquire_about_wait}</a>
			</li>
		</ul>
	</form>
</div>
<script type="text/javascript" reload="1">
	var search_timer = null;
	if(!window.evernote_imported) window.evernote_imported = [];
	evernote_search();
	jQuery(document).on('keyup', '.js-search-evernote-input', function(e) {
		var term = this.value;
		if(e.keyCode == 13) {
			if(search_timer) window.clearTimeout(search_timer);
			evernote_search(term);
		} else {
			if(search_timer) window.clearTimeout(search_timer);
			search_timer = window.setTimeout(function() {
				evernote_search(term);
			}, 500);
		}
	});

	function evernote_search(term) {
		jQuery('#evernote_list_{$id} .spinner.js-loading').show();
		jQuery.post('{MOD_URL}&op=evernote&do=notes', jQuery('#evernote_list_{$id}').serialize(), function(json) {
			if(json.error) showmessage(json.error, 'danger', 3000, 1);
			else if(json) {
				var html = '';
				for(var i = 0; i < json.length; i++) {
					if(jQuery.inArray(json[i].guid, window.evernote_imported) > -1) continue;
					html += ' <li id="' + json[i].guid + '" class="item js-note-item" data-id="' + json[i].id + '">';
					html += '		<a title="'+__lang.add_folder+'" href="javascript:;" style="position:relative;padding-right:30px">' + json[i].title + '';
					html += ' 	<span class="spinner small js-importing" style="display: none;top:0" title="'+__lang.leading_in+'"><img src="dzz/corpus/images/spinner.gif"></span>';
					html += '		</a>';
					html += '	</li>';
				}
				if(html == '') html = '<li><a href="javascript:;">'+__lang.unfound_notes+'</a></li>';
				jQuery('#evernote_list_{$id} .js-list').html(html);

			}
			jQuery('#evernote_list_{$id} .js-loading').hide();
		}, 'json');
	}
	jQuery(document).on('click', '.js-note-item', function() {
		if(jQuery(this).find('.js-importing:visible').length) return false;
		jQuery(this).find('.js-importing').show();
		jstree_import_from_evernote(this.id, jQuery(this).data('id'));
		return false;
	});
</script>
<!--{elseif $operation=='newdoc'}-->
<div class="popbox-body" style="padding:15px 18px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-select" href="javascript:;" onclick="jQuery('.openpop').popbox('close');jstree_create_dir($num,0)">
				{lang vice_text_document}
			</a>
		</li>
		<li>
			<a class="js-select" href="javascript:;" onclick="jQuery('.openpop').popbox('close');jstree_create_dir($num,1)">
				Markdown
			</a>
		</li>
	</ul>
</div>

<!--{elseif $operation=='download'}-->
<div class="popbox-body" style="padding:15px 18px;min-width:100px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<!--{loop $allowdown $key $value}-->
		<!--{if (!$corpus[allowdown]) || (intval($corpus[allowdown]) & intval($key))}-->
		<li>
			<a class="js-select-down" href="{MOD_URL}&op=output&cid=$cid&format=$value&fid=$fid" onclick="jQuery('.openpop').popbox('close');" target="_blank">
				$value
				<!--{if $download[$value]}-->
				<span class="text-mute" title="{lang download_times}">($download[$value])</span>
				<!--{/if}-->
			</a>
		</li>
		<!--{/if}-->
		<!--{/loop}-->
	</ul>

</div>
<script type="text/javascript">
	jQuery('a.js-select-down').on('click', function() {
		jQuery('.openpop').popbox('close');
		if(converting > 0) return false;
		var url = this.href;
		showmessage('<i class="fa fa-spinner fa-spin"></i>'+__lang.preparing_documents_need_time, 'warning', 0, 1);
		convert_waiting(url + '&check=1&t=' + new Date().getTime(), function(json) {
			if(json.msg == 'success') {
				showmessage('<i class="fa fa-ok"></i>'+__lang.convert_successful_downloading, 'success', 1000, 1);
				if(BROWSER.ie) {
					window.open(url);
				} else {
					if(!window.frames['hidefram']) jQuery('<iframe id="hideframe" name="hideframe" src="about:blank" frameborder="0" marginheight="0" marginwidth="0" width="0" height="0" allowtransparency="true" style="display:none;z-index:-99999"></iframe>').appendTo('body');
					window.frames['hideframe'].location = url;
				}
			} else {
				showmessage('<i class="fa fa-alert"></i>' + json.error, 'danger', 3000, 1);
			}
		}, function() {
			showmessage('<i class="fa fa-alert"></i>'+__lang.transcription_error, 'danger', 3000, 1);
		}, 5000);

		return false;
	});
</script>
<!--{elseif $operation=='share'}-->
<div class="popbox-header">
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share}</h3>
</div>
<div class="popbox-body" style="padding:15px 18px;min-width:120px;">
	<!--{if $corpus[viewperm]==1}-->
	<div class="alert alert-warning list-unstyled" style="padding:5px 10px;margin:-10px -10px 15px -10px;min-width:180px;">
		<p><span class="icon-sm icon-private fa fa-lock"></span>{lang within_the_group}</p>
		<p class="sub-name">{lang only_team_members_and_members_of_this_corpus_can_view}</p>
		<p class="danger">{lang pay_attention_to_share_objects}</p>
	</div>
	<!--{elseif $corpus[viewperm]==0}-->
	<div class="alert alert-warning list-unstyled" style="padding:5px 10px;margin:-10px -10px 15px -10px;min-width:180px;">
		<p><span class="icon-sm icon-private fa fa-lock"></span> {lang privately_owned}</p>
		<p class="sub-name">{lang only_members_of_this_corpus_can_view}</p>
		<p class="danger">{lang pay_attention_to_share_objects}</p>
	</div>
	<!--{/if}-->
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-select  js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=shareurl&cid=$cid&fid=$fid" title="{lang share_addresses_and_codes}">
				<i class="fa fa-link"></i> &nbsp;{lang address}
			</a>
		</li>
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=sharetowechat&cid=$cid&fid=$fid" title="{lang share_to_WeChat}">
				<i class="fa fa-weixin"></i> &nbsp;{lang WeChat}
			</a>
		</li>
		<li>
			<a class="js-select" href="http://connect.qq.com/widget/shareqq/index.html?url={eval echo urlencode($shareurl);}&showcount=0&desc={eval echo rawurlencode($name);}&title={eval echo rawurlencode($name);}&site={eval echo rawurlencode($_G[sitename])}" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_QQ}">
				<i class="fa fa-qq"></i> &nbsp;{lang QQ_friends}
			</a>
		</li>
		<li>
			<a class="js-select" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={eval echo urlencode($shareurl);}&showcount=0&desc={eval echo rawurlencode($name);}&title={eval echo rawurlencode($name);}&site={eval echo rawurlencode($_G[sitename])}" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_QQ}">
				<i class="fa fa-qq"></i> &nbsp;{lang Qzone}
			</a>
		</li>
		<li>
			<a class="js-select sharetoweibo" href="http://service.weibo.com/share/share.php?title={eval echo rawurlencode($name);}&url={eval echo urlencode($shareurl);}&source=bookmark&appkey=1153621900&pic=&ralateUid=" onclick="jQuery('.openpop').popbox('close');" target="_blank" title="{lang share_to_sina}">
				<i class="fa fa-weibo"></i> &nbsp;{lang sina_microblog}
			</a>
		</li>
	</ul>
</div>
<!--{elseif $operation=='shareurl'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share_addresses_and_codes}</h3>
</div>
<div class="popbox-body" style="min-width:220px;">
	<!--{if $qrcode}-->
	<p class="text-center"><img class="img-thumbnail" src="$qrcode"></p>
	<!--{/if}-->
	<input type="text" class="form-control" style="cursor:default;background:#FFF" spellingcheck="false" readonly name="shareurl" value='$shareurl' onclick="this.select()">

</div>
<!--{elseif $operation=='perm'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang permission_setting}</h3>
</div>
<div id="perm_setting_{$cid}" class="popbox-body" style="max-width:250px;">
	<ul class="popbox-list list-unstyled">
		<!--{if !$org || $corpus['orgperm']>2 || $org[perm]>2 || ($org[mperm_c] && ($org[mperm_c] & 1))}-->
		<li>
			<a class="js-select" href="#" name="private">
				<span class="icon-sm icon-private glyphicon glyphicon-lock"></span>{lang privately_owned}
				<span class="select icon-sm glyphicon <!--{if $corpus['viewperm']<1}--> glyphicon-ok<!--{/if}-->"></span>
				<span class="sub-name">{lang only_members_of_this_corpus_can_view_edit}</span>
			</a>
		</li>
		<!--{/if}-->
		<!--{if $corpus['orgperm']>2 || ($org[mperm_c] && ($org[mperm_c] & 2))}-->
		<li>
			<a class="js-select " href="#" name="org">
				<span class="icon-sm icon-organization-visible glyphicon glyphicon-th-large"></span>{lang within_the_group}
				<span class="select icon-sm glyphicon <!--{if $corpus['viewperm']==1}-->glyphicon-ok<!--{/if}-->"></span>
				<span class="sub-name">{lang group_visibility_only_members_of_this_corpus_can_edit}</span>
			</a>
		</li>
		<!--{/if}-->
		<!--{if !$org || $corpus[orgperm]>2 || ($org[mperm_c] && ($org[mperm_c] & 4))}-->
		<li>
			<a class="js-select" href="#" name="public">
				<span class="icon-sm icon-public glyphicon glyphicon-globe"></span>{lang open}
				<span class="select icon-sm glyphicon <!--{if $corpus['viewperm']==2}-->glyphicon-ok<!--{/if}-->"></span>
				<span class="sub-name">{lang open_only_members_of_this_corpus_can_edit}</span>
			</a>
		</li>
		<!--{/if}-->
	</ul>

</div>
<script type="text/javascript">
	jQuery('#perm_setting_{$cid} .js-select').on('click', function() {
		if(jQuery(this).hasClass('disabled')) return false;
		jQuery('#perm_setting_{$cid} .js-select span.select').removeClass('glyphicon-ok');
		jQuery(this).find('.select').addClass('glyphicon-ok');
		var perm = 0;
		switch(jQuery(this).attr('name')) {
			case 'private':
				perm = 0;
				break;
			case 'org':
				perm = 1;
				break;
			case 'public':
				perm = 2;
				break;
		}
		jQuery.post('{MOD_URL}&op=list&do=ajax&operation=setCorpus', {
			"cid": '{$cid}',
			"name": 'perm',
			'val': perm
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
			}
			if(perm > 1) {
				jQuery('.list-flex-hover[data-cid="$cid"] .list-flex2').text(__lang.open);
				jQuery('.board-list li[data-cid="$cid"] .item-guide:not(.forbid)').attr('class', 'item-guide perm_2');
			} else if(perm == 0){
				jQuery('.list-flex-hover[data-cid="$cid"] .list-flex2').text(__lang.privately_owned);
				jQuery('.board-list li[data-cid="$cid"] .item-guide:not(.forbid)').attr('class', 'item-guide perm_0');
			} else if(perm == 1){
				jQuery('.list-flex-hover[data-cid="$cid"] .list-flex2').text(__lang.group);
				jQuery('.board-list li[data-cid="$cid"] .item-guide:not(.forbid)').attr('class', 'item-guide perm_1');
			} else {
				jQuery('.list-flex-hover[data-cid="$cid"] .list-flex2').text('');
				jQuery('.board-list li[data-cid="$cid"] .item-guide:not(.forbid)').attr('class', 'item-guide');
			}
			jQuery('.popbox .back').trigger('click');
		}, 'json');
		return false;
	});
</script>
<!--{elseif $operation=='sharetowechat'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang share_the_WeChat_friends_circle}</h3>
</div>
<div class="popbox-body" style="min-width:220px;">
	<p class="text-center"><img src="$qrcode"></p>
	<p class="help-block">{lang codes_share_the_WeChat_friends_circle}</p>
</div>
<!--{elseif $operation=='reversion'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang the_version_of_history}</h3>
</div>
<div class="popbox-body" style="min-width:250px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<!--{loop $versions $value1}-->
		<li>
			<a href="javacript:;" class="cancel" tabindex="-1" role="menuitem" onclick="getTopicListByFid('$class[fid]','$value1[version]');return false">
				<b>#{$value1[version]}</b>:{eval echo dgmdate($value1[dateline])} {$value1[username]}
			</a>
		</li>
		<!--{/loop}-->
	</ul>
</div>
<!--{elseif $operation=='setting'}-->
<div class="popbox-header">
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang base_setting}</h3>
</div>
<div class="popbox-body" style="padding:15px 18px;min-width:200px;">

	<ul class="popbox-menu u-bottom list-unstyled">
		<!--{if $from=='cover'}-->
		<li>
			<a class="js-select js-started" href="javascript:;"> <i class="fa fa-star"></i> &nbsp;{lang sign_or_cancel}</a>
		</li>
		<!--{/if}-->
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=cover&cid=$cid" title="{lang cover_setting}"> <i class="fa fa-edit"></i> &nbsp;{lang cover_setting}</a>
		</li>
		<!--{if $from!='cover'}-->
		
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=comment&cid=$cid" title="{lang comment_on_the_switch}">
				<i class="fa fa-comment"></i>{lang comment_settings}：
				<!--{if $corpus['forbidcommit']}-->
				{lang task_right_close}
				<!--{else}-->
				{lang switch_on}
				<!--{/if}-->
			</a>
		</li>
		<!--{/if}-->
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=perm&cid=$cid" title="{lang permission_setting}">
				<i class="fa fa-eye"></i>{lang permission_setting}：
				<!--{if $corpus['viewperm']=='0'}-->
				<i class="icon-sm icon-private glyphicon glyphicon-lock"></i>&nbsp;{lang privately_owned}
				<!--{elseif $corpus['viewperm']=='1'}-->
				<i class="icon-sm icon-organization-visible glyphicon glyphicon-th-large"></i>&nbsp;{lang within_the_group}
				<!--{elseif $corpus['viewperm']=='2'}-->
				<i class="icon-sm  icon-public glyphicon  glyphicon-globe"></i>&nbsp;{lang open}
				<!--{/if}-->
			</a>
		</li>
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=moveto&cid=$cid" title="{lang move_to_group}">
				<i class="fa fa-share"></i>{lang move_to}

			</a>
		</li>
		<!--{if $from!='cover'}-->
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=allowdown&cid=$cid" title="{lang download_setting}"> <i class="fa fa-download"></i> &nbsp;{lang download_options}</a>
		</li>
		<!--{/if}-->
		
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=archive&cid=$cid" title="{lang archive_options}">
				<!--{if $corpus['archivetime']}-->
				<span class="danger"><i class="fa fa-archive"></i> &nbsp;{lang archived}</span>
				<!--{else}-->
				<i class="fa fa-archive"></i> &nbsp;{lang archive}
				<!--{/if}-->
			</a>
		</li>
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=delete&cid=$cid" title="{lang delete}">
				<!--{if $corpus['deletetime']}-->
				<span class="danger"><i class="fa fa-remove"></i>&nbsp;{lang deleted}</span>
				<!--{else}-->
				<i class="fa fa-remove"></i>&nbsp;{lang delete}
				<!--{/if}-->
			</a>
		</li>
		<!--{if getAdminPerm()}-->
		<li>
			<a class="js-select js-popbox" href="javascript:;" data-href="{MOD_URL}&op=menu&do=topic&operation=ban&cid=$cid" title="{lang banned_operation}">
				{if $corpus['modreasons']}<span class="danger"><i class="fa fa-ban"></i>&nbsp;{lang been_banned}</span>{elseif is_numeric($corpus['modreasons'])== true}
				<span class="danger"><i class="fa fa-ban"></i>&nbsp;{lang been_banned}</span>
				{else}
				<i class="fa fa-ban"></i>&nbsp;{lang banned}
				{/if}
			</a>
		</li>
		<!--{/if}-->
	</ul>
</div>
<script type="text/javascript">
	jQuery('.js-started').on('click', function() {
		jQuery('li[data-cid="$cid"] .js-star').first().trigger('click');
		jQuery('.popbox .close').trigger('click');
		return false;
	});
</script>
<!--{elseif $operation=='moveto'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang move_to_group}</h3>
</div>
<div class="popbox-body" style="min-width:250px;max-height:400px;overflow:auto;padding:5px">
	<!--{if $corpus['orgperm']<3 && $org && $org['removeperm']<1 }-->
	<div class="alert alert-warning" style="margin-bottom:0;">
		{lang contact_group_administrator}
	</div>
	<!--{else}-->
	<!--{if !$current && !$myorgs}-->
	<div class="alert alert-warning" style="margin-bottom:0;">
		{lang not_to_join}
	</div>
	<!--{else}-->
	<ul class="popbox-menu u-bottom list-unstyled" style="margin:0">
		<!--{if $current}-->
		<li>
			<a class="js-org" href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=moveto&cid=$cid" style="padding-left:30px;position:relative" data-orgid="0">
				<!--{if $current['logo']}-->
				<span class="icon-lg icon-organization mod-custom-image background-cover" style="background-image:url({DZZSCRIPT}?mod=io&op=thumbnail&width=256&height=256&path={eval echo dzzencode('attach::'.$current['logo']);});left:5px;top:8px;position:absolute;max-width:20px;max-height:20px" alt="logo"></span>
				<!--{else}-->
				<span class="icon-lg  icon-organization fa fa-group" style="left:5px;top:8px;max-width:20px;max-height:20px;position:absolute"></span>
				<!--{/if}-->
				{lang from}”{$current[name]}“{lang remove_the}
			</a>
		</li>
		<!--{/if}-->
		<!--{loop $myorgs $value}-->
		<li>
			<a class="js-org" href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=moveto&cid=$cid" style="padding-left:30px;position:relative" data-orgid="$value[orgid]">
				<!--{if $value['logo']}-->
				<span class="icon-lg icon-organization mod-custom-image background-cover" style="background-image:url({DZZSCRIPT}?mod=io&op=thumbnail&width=256&height=256&path={eval echo dzzencode('attach::'.$value['logo']);});left:5px;top:8px;position:absolute;max-width:20px;max-height:20px" alt="logo"></span>
				<!--{else}-->
				<span class="icon-lg  icon-organization fa fa-group" style="left:5px;top:8px;max-width:20px;max-height:20px;position:absolute"></span>
				<!--{/if}-->
				$value[name]
			</a>
		</li>
		<!--{/loop}-->
	</ul>
	<!--{/if}-->
	<!--{/if}-->
</div>
<script type="text/javascript">
	jQuery('.js-org').on('click', function() {
		var el = jQuery(this);
		jQuery.post(el.data('href'), {
			'orgid': el.data('orgid')
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
			} else {
					if(jQuery('li[data-cid="{$cid}"]').closest('.window-module').hasClass('window-module-my')){
						jQuery('.window-module-my').find('li[data-cid="{$cid}"]').appendTo('#board_list_' + el.data('orgid'));
						jQuery('.window-list-my').find('.list-flex-hover[data-cid="{$cid}"]').appendTo('#board_table_' + el.data('orgid'));
					}else{
						jQuery('.window-module-org').find('li[data-cid="{$cid}"]').appendTo('#board_list_' + el.data('orgid'));
						jQuery('.window-list-org').find('.list-flex-hover[data-cid="{$cid}"]').appendTo('#board_table_' + el.data('orgid'));
					}
				jQuery('.popbox .close').trigger('click');
			}
		}, 'json');
	});
</script>
<!--{elseif $operation=='theme'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang list_style}</h3>
</div>
<div class="popbox-body" style="min-width:150px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-theme" href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=theme&cid=$cid" data-theme="1">
				<span class="icon-sm icon-private fa fa-list"></span> {lang no_icon_style}
				<span class="select icon-sm glyphicon <!--{if $corpus[theme]>0}--> glyphicon-ok<!--{/if}-->"></span>

			</a>
		</li>
		<li>
			<a class="js-theme " href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=theme&cid=$cid" data-theme="0">
				<span class="icon-sm icon-organization-visible glyphicon glyphicon-th-large"></span>{lang default_style}
				<span class="select icon-sm glyphicon <!--{if $corpus[theme]<1}-->glyphicon-ok<!--{/if}-->"></span>
			</a>
		</li>
	</ul>
</div>
<script type="text/javascript">
	jQuery('.js-theme').on('click', function() {
		var el = jQuery(this);
		var theme = parseInt(el.data('theme'));
		jQuery.post(el.data('href'), {
			"theme": theme
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
			} else {
				el.data('theme', theme);
				if(theme) {
					jQuery('.left-wrapper').addClass('classtree-simple').addClass('jstree-no-icons');
					el.html(' <i class="fa fa-list"></i> &nbsp;'+__lang.no_icon_style);
				} else {
					jQuery('.left-wrapper').removeClass('classtree-simple').removeClass('jstree-no-icons');
					el.html(' <i class="fa fa-list"></i> &nbsp;'+__lang.default_style);
				}
				jQuery('.popbox .close').trigger('click');
			}
		}, 'json');
	});
</script>
<!--{elseif $operation=='comment'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang comment_on_the_switch}</h3>
</div>
<div class="popbox-body" style="min-width:150px;">
	<ul class="popbox-menu u-bottom list-unstyled">
		<li>
			<a class="js-comment" href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=comment&cid=$cid" data-comment="1">
				<span class="icon-sm icon-private fa fa-list"></span>{lang prohibit_comments}
				<span class="select icon-sm glyphicon <!--{if $corpus[forbidcommit]>0}--> glyphicon-ok<!--{/if}-->"></span>

			</a>
		</li>
		<li>
			<a class="js-comment " href="javascript:;" data-href="{MOD_URL}&op=list&do=ajax&operation=comment&cid=$cid" data-comment="0">
				<span class="icon-sm icon-organization-visible glyphicon glyphicon-th-large"></span>{lang allow_comments}
				<span class="select icon-sm glyphicon <!--{if $corpus[forbidcommit]<1}-->glyphicon-ok<!--{/if}-->"></span>
			</a>
		</li>
	</ul>
</div>
<script type="text/javascript">
	jQuery('.js-comment').on('click', function() {
		var el = jQuery(this);
		var comment = parseInt(el.data('comment'));
		jQuery.post(el.data('href'), {
			"comment": comment
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
			} else {
				el.data('comment', comment);
				if(comment) {
					showmessage(__lang.comment_closed_successfully, 'success', 2000, 1);
					el.html(' <i class="fa fa-comment"></i> &nbsp;'+__lang.allow_comments);
				} else {
					showmessage(__lang.comment_opened_successfully, 'success', 2000, 1);
					el.html(' <i class="fa fa-comment"></i> &nbsp;'+__lang.prohibit_comments);
				}
				jQuery('.popbox .close').trigger('click');
			}
		}, 'json');
	});
</script>
<!--{elseif $operation=='archive'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang archive_options}</h3>
</div>
<div class="popbox-body">
	<!--{if $corpus['archivetime']}-->
	<p>{lang reactivate_this_corpus_from_the_archive_library}</p>

	<!--{else}-->
	<p class="text-danger"><span>{lang make_sure_to_archive_this_corpus}</span></p>
	<!--{/if}-->
</div>
<div class="popbox-footer text-right">
	<!--{if $corpus['archivetime']}-->
	<button type="button" class="btn btn-width btn-warning mr15" data-loading-text="{lang activation_of}" onclick="corpus_archive('$cid','restore',this)">{lang activation_of_the_corpus}</button>
	<!--{else}-->
	<button type="button" class="btn btn-danger mr15" data-loading-text="{lang archiving}" onclick="corpus_archive('$cid','archive',this)">{lang archive_this_corpus}</button>
	<!--{/if}-->
	<button class="btn btn-simple cancel">{lang cancel}</button>
</div>
<script type="text/javascript">
	function corpus_archive(cid, op, obj) {
		jQuery(obj).button('loading');
		jQuery.post('{MOD_URL}&op=list&cid=$cid&do=ajax&operation=' + op, {
			't': new Date().getTime()
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
				jQuery(obj).button('reset');
			} else {
				if(jQuery('.board-list li[data-cid="' + cid + '"]').length) { //在列表页
					jQuery('.openpop').popbox('close');
					jQuery('.board-list li[data-cid="' + cid + '"]').remove();
					jQuery('.list-flex-hover[data-cid="' + cid + '"]').remove();
				} else if(jQuery('#classtree').length) { //在书内页
					showmessage(json.msg+__lang.app_permissions, 'danger', 3000, 1);
					window.setTimeout(function() {
						window.location.reload()
					}, 500);
				}
			}
		}, 'json');
	}
</script>
<!--{elseif $operation=='delete'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang delete_options}</h3>
</div>
<div class="popbox-body">
	<!--{if $corpus['deletetime']}-->
	<p class="text-danger">{lang operation_delete_this_corpus_completely}</p>
	<!--{else}-->
	<p class="text-danger"><span>{lang delete_this_collection_temporarily}</span></p>
	<!--{/if}-->
</div>
<div class="popbox-footer text-right">
	<!--{if $corpus['deletetime']}-->
	<button type="button" class="btn  btn-warning mr15" data-loading-text="{lang in_recovery}" onclick="corpus_delete(this,'$cid','restore')">{lang restore_the_corpus}</button>
	<button type="button" class="btn  btn-danger " data-loading-text="{lang deletion}" onclick="corpus_delete(this,'$cid','delete',1)">{lang completely_delete}</button>
	<button type="button" class="btn  btn-danger" data-loading-text="{lang deletion}" onclick="corpus_deleteDialog(this,'$cid','delete',1)">{lang completely_delete}</button>
	<!--{else}-->
	<button type="button" class="btn btn-danger mr15" data-loading-text="{lang deletion}" onclick="corpus_delete(this,'$cid','delete')">{lang delete_this_corpus}</button>
	<button class="btn btn-simple cancel">{lang cancel}</button>
	<!--{/if}-->

</div>
<script type="text/javascript">
	function corpus_delete(obj, cid, op, queren) {
		jQuery(obj).button('loading');
		jQuery.post('{MOD_URL}&op=list&cid=$cid&do=ajax&operation=' + op, {
			't': new Date().getTime()
		}, function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
				jQuery(obj).button('reset');
			} else {
				if(jQuery('.board-list li[data-cid="' + cid + '"]').length) { //在列表页
					jQuery('.openpop').popbox('close');
					jQuery('.board-list li[data-cid="' + cid + '"]').remove();
					jQuery('.list-flex-hover[data-cid="' + cid + '"]').remove();
				} else if(jQuery('#classtree').length) { //在书内页
					showmessage(json.msg + __lang.app_permissions, 'danger', 3000, 1);
					<!--{if $corpus['deletetime'] && $op=='delete'}-->
					window.location.href = '{MOD_URL}';
					<!--{else}-->
					window.setTimeout(function() {
						window.location.reload()
					}, 500);
					<!--{/if}-->
				}

			}
		}, 'json');
	}

	function corpus_deleteDialog(obj, cid, op, queren){
		var msg = __lang.sure_delete_this_corpus_completely;
	    var mode = 'confirm';
	    var title = '';
	    var cover = '1';
	    var leftmsg = '';
	    var confirmtxt = __lang.confirms;
	    var canceltxt = __lang.cancel;

	    showDialog(msg,mode,title,function(){corpus_delete(obj, cid, op, queren)},1);
	}
</script>
<!--{elseif $operation=='ban'}-->
<div class="popbox-header">
	<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
	<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
	<h3 class="text-left">{lang banned_operation}</h3>
</div>
<div class="popbox-body">
	<div class="alert alert-danger " style="padding:10px;">
		<h5>{lang banned_books_will_lose_the_following_functions}</h5>
		<ol style="margin:0;">
			<li>{lang cannot_be_set_to_public}</li>
			<li>{lang not_download}</li>
		</ol>
		</ol>
	</div>
	<h5 style="font-weight:bold">{lang Choose_the_reasons_for_the_embargo_choose_more}</h5>
	<div class="clearfix">
		<form id="ban_corpus_{$corpus['cid']}">
			<input type="hidden" name="handlekey" value="ban" />
			<input type="hidden" name="bansubmit" value="true" />
			<input type="hidden" name="formhash" value="{FORMHASH}" />
			<!--{loop $modreasons $key $value}-->
			<label style="font-weight:normal;display:block;"> <input type="checkbox" class="js-ban-item"  name="modreasons[]" value="$key" <!--{if in_array($key,$corpus[modreasons])}-->checked="checked"<!--{/if}--> /> $value</label>
			<!--{/loop}-->
		</form>
	</div>
</div>
<div class="popbox-footer text-right">
	<button type="button" class="btn  btn-danger" style="margin:0 5px;" data-loading-text="{lang banned_in}" onclick="corpus_ban(this,'$cid','ban')">{lang banned_this_corpus}</button>
	<button type="button" class="btn  btn-warning" style="margin:0 5px;" data-loading-text="{lang in_recovery}" onclick="corpus_ban(this,'$cid','unban')">{lang cancel_banned}</button>
</div>
<script type="text/javascript">
	function corpus_ban(obj, cid, op) {

		if(op == 'unban') {
			if(!confirm(__lang.Are_you_sure_you_want_to_unblock_this_anthology)) {
				return;
			}
			jQuery('.js-ban-item').removeProp('checked');
		} else {

			if(!jQuery('.js-ban-item:checked').length) {
				jQuery(obj).html(__lang.select_the_reasons_for_the_embargo);
				window.setTimeout(function() {
					jQuery(obj).html(__lang.banned_this_corpus);
				}, 2000);
				showmessage('请选择封禁理由','danger',3000,1);
				return;
			}
			if(!confirm(__lang.sure_ban_this_corpus)) {
				return;
			}
		}
		jQuery(obj).button('loading');
		jQuery.post('{MOD_URL}&op=list&cid=$cid&do=ajax&operation=' + op, jQuery('#ban_corpus_{$cid}').serialize(), function(json) {
			if(json.error) {
				showmessage(json.error, 'danger', 3000, 1);
				jQuery(obj).button('reset');
			} else {
				jQuery('.openpop').popbox('close');
				showmessage(__lang.operate_successfully, 'success', 1000, 1);
				window.setTimeout(function() {
					window.location.reload()
				}, 1000);
			}
		}, 'json');
	}
</script>
<!--{elseif $operation=='allowdown'}-->
<form name="allowdownform">
	<div class="popbox-header">
		<button class="back glyphicon glyphicon-chevron-left js-popbox-prev"></button>
		<button class="close fa fa-remove" type="button" style="font-weight:normal;font-size:20px;"></button>
		<h3 class="text-center">{lang download_options}</h3>
	</div>
	<div class="popbox-body" style="max-width:250px;">
		<!--{if $allowdown_m}-->
		<h5>{lang people_who_are_allowed_to_download}</h5>
		<div id="allowdown_m_itemContainer" class="clearfix">
			{eval $sum_m=0;}
			<!--{loop $allowdown_m $key $value}-->
			{eval $sum_m+=$key}
			<div class="col-xs-12 mb10"><label class="checkbox-inline"><input type="checkbox" name="allowdown_m[]" value="$key"<!--{if (!$corpus[allowdown_m]) || (intval($corpus[allowdown_m]) & intval($key))}-->checked="checked"<!--{/if}--> /> $value</label></div>
			<!--{/loop}-->

		</div>
		<!--{/if}-->
		<!--{if $allowdown}-->
		<h5>{lang allow_the_download_format}</h5>
		<div id="allowdown_itemContainer" class="clearfix">
			{eval $sum=0;}
			<!--{loop $allowdown $key $value}-->
			{eval $sum+=$key}
			<div class="col-xs-6 mb10"><label class="checkbox-inline"><input type="checkbox" name="allowdown[]" value="$key"<!--{if (!$corpus[allowdown]) || (intval($corpus[allowdown]) & intval($key))}-->checked="checked"<!--{/if}--> /> $value</label></div>
			<!--{/loop}-->
			<div class="col-xs-12"><label class="checkbox-inline"><input id="alllowdown_chkall" type="checkbox" name="chkall" value="1"<!--{if (!$corpus[allowdown]) || ($corpus[allowdown] == $sum)}-->checked="checked"<!--{/if}--> onchange="allowdown_chkall(this);" /> {lang all_format}</label></div>

		</div>
		<!--{/if}-->
	</div>
	<div class="popbox-footer text-right">

		<button type="button" class="btn btn-width btn-danger mr15" data-loading-text="{lang save_in_the}" onclick="corpus_allowdown(this,'$cid')">{lang submit}</button>
		<button class="btn btn-simple js-popbox-prev">{lang cancel}</button>

	</div>
</form>
<script type="text/javascript">
	function allowdown_chkall(obj) {
		var el = jQuery(obj);
		if(el.prop('checked')) {
			jQuery('#allowdown_itemContainer input[name="allowdown[]"]').prop('checked', true);
		} else {
			jQuery('#allowdown_itemContainer input[name="allowdown[]"]').removeProp('checked');
		}
	}

	function corpus_allowdown(obj, cid) {
		var val = 1;
		var allchk = 1;
		jQuery('#allowdown_itemContainer input[name="allowdown[]"]').each(function() {
			if(jQuery(this).prop('checked')) {
				val += parseInt(this.value);
			} else {
				allchk = 0;
			}
		});
		if(allchk) val = 0;

		var val_m = 1;
		jQuery('#allowdown_m_itemContainer input[name="allowdown_m[]"]').each(function() {
			if(jQuery(this).prop('checked')) {
				val_m += parseInt(this.value);
			}
		});

		jQuery(obj).button('loading');
		jQuery.post('{MOD_URL}&op=list&cid=$cid&do=ajax&operation=setCorpus', {
			'name': ['allowdown', 'allowdown_m'],
			'val': [val, val_m]
		}, function() {
			jQuery('.openpop').popbox('close');
		});
	}
</script>
<!--{elseif $operation=='cover'}-->
<div class="popbox-header text-center">
	<button class="close fa fa-remove" style="font-weight:normal;font-size:20px;"></button>
	<h3>{lang modify_cover_information}</h3>
</div>
<div id="popbox_cover" class="popbox-body" style="width:300px;">
	<div class="form-group">
		<label>{lang appname}</label>
		<input id="cover_name" type="text" name="name" class="form-control" value="$corpus[name]" onchange="setCorpus('name',this.value,'$cid')">
	</div>
	<div class="form-group">
		<label>{lang bg_color}</label>
		<input id="cover_color" type="hidden" name="color" value="$corpus[color]" onchange="setCorpus('color',this.value,'$cid')" />
		<div class="clearfix">
			<!--{loop $colorarr $val}-->
			<span class="color-label text-center" style="background-color: $val;" data-color="$val">
            <!--{if $corpus['color']==$val}--><i class=" glyphicon glyphicon-ok"></i><!--{/if}-->
            </span>
			<!--{/loop}-->
		</div>
	</div>
	<div class="form-group" style="margin-bottom:0;">
		<div id="cover_container" class="clearfix" style="">
			<label>{lang cover_image}</label>
			<input id="cover_1" name="cover" type="hidden" value="$corpus[aid]" onchange="setCorpus('aid',this.value,'$cid')" />
			<div id="cover_preview_1" style="position:relative;margin-bottom:10px;">
				<!--{if $corpus[aid]}--><img class="thumbnail" style="margin-bottom:0;max-width:150px;max-height:200px;" src="{DZZSCRIPT}?mod=io&op=thumbnail&width=150&height=200&path={eval echo dzzencode('attach::'.$corpus[aid]);}" />
				<a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="{lang remove_cover_image}" onclick="remove_backround_url_1()"></a>
				<!--{/if}-->
			</div>

			<div id="cover_upload_1" class="addPhotoBar" style="position:relative;padding:10px;border:1px dashed #e1e1e1;overflow:hidden">
				<div class="uploadwrap"><input id="fileupload_1" type="file" name="files[]" multiple accept="image/png,image/gif,image/jpeg"></div>
				<div class="addbtn">
					<i class="glyphicon glyphicon-plus"></i> {lang cover_image_size}
				</div>
			</div>
			<span class="help-block">{lang only_show_cover_picture}</span>
		</div>
	</div>
</div>

<script type="text/javascript" reload="1">
	jQuery('#popbox_cover .color-label').on('click', function() {
		jQuery('#popbox_cover .color-label').html('');

		var color = jQuery(this).data('color');
		if(color == jQuery('#cover_color').val()) {
			color = '';
		}
		jQuery('#cover_color').val(color).trigger('onchange');
		if(color) {
			jQuery(this).html('<i class="icon-white glyphicon glyphicon-ok"></i>');
			jQuery('li[data-cid="$cid"] a.js-open-board,.cover-body').addClass('color-white');
		}
		jQuery('.cover-body').css('background-color', color ? color : 'transparent');
		jQuery('li[data-cid="$cid"]').each(function() {
			jQuery(this).find('a.js-open-board').css('background-color', color ? color : 'transparent');
		});
		jQuery('.list-flex-hover[data-cid="$cid"] .color-list-icon').css('background-color', color ? color : 'transparent');
		return false;
	});

	jQuery('#cover_name').on('keyup', function(e) {
		var li = jQuery('li[data-cid="$cid"]');
		li.find('.details').text(this.value);
		jQuery('.classtree-cname span').text(this.value);
	});

	function remove_backround_url_1(obj) {
		jQuery('#cover_preview_1').empty();
		jQuery('#cover_1').val('').trigger('onchange');
		jQuery('li[data-cid="$cid"] img.cover').attr('src', 'dzz/images/b.gif');
		jQuery('.list-flex-hover[data-cid="$cid"] img').attr('src','dzz/images/b.gif');
		jQuery('#cover_body').removeClass('cover').find('img.cover').attr('src', 'dzz/images/b.gif');

		return false;
	}

	function checkISBN(val, cid) {
		if(val) {
			var regex = new RegExp("^\\d{1,5}-{0,1}\\d{1,5}-{0,1}\\d{1,6}-{0,1}\\d{1}$", 'i');
			if(!regex.test(val)) {
				showmessage(__lang.ISBN_incorrect, 'danger', 3000, 1);
				return false;
			}
		}
		setCorpus('--isbn', val, cid);
	}

	function setCorpus(name, val, cid) {
		jQuery.post('{MOD_URL}&op=list&do=ajax&operation=setCorpus', {
			'name': name,
			'val': val,
			'cid': cid
		}, function(json) {
			if(json.msg == 'success') jQuery('.cover' + name).text(val);
		}, 'json');
	}
	jQuery('#fileupload_1').fileupload({
		url: '{MOD_URL}&op=ajax&do=imageupload',
		dataType: 'json',
		autoUpload: true,
		maxFileSize: null, // 2 MB
		maxChunkSize: 2000000, //2M
		acceptFileTypes: new RegExp("(\.|\/)([jpeg|jpg|gif|png|bmp])$", 'i'),
		dropZone: jQuery('#cover_container'),
		dropZone: jQuery('#cover_container'),
		sequentialUploads: true,

	}).on('fileuploaddone', function(e, data) {
		jQuery.each(data.result.files, function(index, file) {
			jQuery('#cover_preview_1').html('<img class="thumbnail" style="margin-bottom:0;max-width:150px;max-height:200px;" src="' + file.data.img + '" /><a href="javascript:;" style="position:absolute;left:0;top:0;" class="ibtn glyphicon glyphicon-remove" title="'+__lang.remove_cover_image+'" onclick="remove_backround_url_1()"></a>');
			jQuery('#cover_1').val(file.data.aid).trigger('onchange');
			jQuery('li[data-cid="$cid"] img.cover').attr('src', (file.data.img));
			jQuery('.list-flex-hover[data-cid="$cid"] img').attr('src', (file.data.img));
			var imgurl='{DZZSCRIPT}?mod=io&op=thumbnail&width=1600&height=2560&path='+file.data.dpath;
			jQuery('#cover_body img.cover').attr('src',imgurl);
			
			if(jQuery('#cover_body img.cover').length) setImage(jQuery('#cover_body .cover').get(0), '100%', '100%', 1);

		});
	});
</script>
<!--{/if}-->

<!--{/if}-->